package com.itawei.d3_io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * 文件拷贝
 */
public class ByteStreamDemo6 {
    public static void main(String[] args) throws IOException {
        //1.创建对象
        FileInputStream fis = new FileInputStream("C:\\Program Files\\Java\\src\\aaa.txt");
        FileOutputStream fos = new FileOutputStream("day06-file-io\\copy.txt");
        //2.while循环读取数据
        int b;
        while((b = fis.read()) != -1){
            fos.write(b);
        }

        //3.释放数据
        fos.close();
        fis.close();
    }
}
